package com.zhiliao.state.demo4;

public abstract class OrderState {
    private int state;
    protected OrderStateContext context;

    public OrderState(int state) {
        this.state = state;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public OrderStateContext getContext() {
        return context;
    }

    public void setContext(OrderStateContext context) {
        this.context = context;
    }
    public abstract boolean checkState(); //检查当前状态
    public void changeState() {
        System.out.println("修改前状态-"+state);
        if (checkState()) {
            // nextState
            System.out.println("修改状态成功-"+state);
        }
    }
}
